const app = getApp()
import { memberList } from '../../../../api/stockRight'
Page({
    data: {
        memberList:[],
        pageNum:1,
        pageSize:20,
    },
    onLoad(){
        this.memberList()
    },
    memberList(){
        let params = {
            pageNum:this.data.pageNum,
            pageSize:this.data.pageSize, 
        }
        memberList(params).then(res=>{
            res.data.data.forEach(item=>{
                item.balance = Number(item.balance).toFixed(2)
                item.num = Number(item.num)
                this.data.memberList.push(item)
            })
            this.setData({
                memberList:this.data.memberList
            })
        })
    },
    toStockRightDetails(item){
        wx.navigateTo({
            url: '/pages/wallet/jumpPage/stockRight/stockRightDetails?type=' + item.currentTarget.dataset.item.type
        })
    },
    onPullDownRefresh() {
        wx.showNavigationBarLoading()
        this.data.pageNum = 1
        this.data.memberList = []
        this.setData({
            memberList:this.data.memberList
        })
        setTimeout(() => {
            wx.hideNavigationBarLoading()
            this.memberList()
            wx.stopPullDownRefresh()
        }, 1000);
    },
    onReachBottom() {
        this.data.pageNum += 1
        this.memberList()
    },
})
